﻿namespace hr_1.Model
{
    public class EducationMilitary
    {
        HRDataContext hrData = new HRDataContext();
        public string EdLevel { get; set; } 
        public string Institution { get; set; }
        public string Faculty { get; set; }
        public string Speciality { get; set; }
        public string Qualification { get; set; }
        public string Degree { get; set; }
        public string DateEnd { get; set; }
        public string Diplom { get; set; }
        public string Status { get; set; }
        public int PersonId { get; set; }

        public EducationMilitary() { }

        public void Save()
        {
            education NewEducation = new education
                {
                    ed_level = EdLevel,
                    institution = Institution,
                    faculty = Faculty,
                    specialuty = Speciality,
                    qualification = Qualification,
                    degree = Degree,
                    date_end = DateEnd,
                    diplom = Diplom,
                    personId = PersonId
                };
            military NewMilitary = new military
                {
                    status = Status,
                    personId = PersonId
                };
            hrData.educations.InsertOnSubmit(NewEducation);
            hrData.militaries.InsertOnSubmit(NewMilitary);
            hrData.SubmitChanges();
        }
    }
}
